import http from "@/utils/http/index";

//  设置角色和权限的关联
export function setRoleCategoryRelation(data) {
  return http({
    url: `/role/SetRoleCategoryRelation`,
    method: "post",
    data,
  });
}
//  获取指定用户的权限
export function getUserRolesByuserId(data) {
  return http({
    url: `/role/userroles/${data.userId}`,
    method: "get",
  });
}

//  获取自己的权限
export function getMyRoles(data) {
  return http({
    url: `/role/myroles`,
    method: "get",
    params: data,
  });
}

//  获取所有的权限
export function getAllRoles(data) {
  return http({
    url: `/role/listAll`,
    method: "get",
    params: data,
  });
}

//  分页获取权限列表
export function getAllRolesByPage(data) {
  return http({
    url: `/role/list`,
    method: "get",
    params: data,
  });
}

//  树形结构返回所有权限列表
export function getTreeRoleList(data) {
  return http({
    url: `/role/treeList`,
    method: "get",
    params: data,
  });
}

//  树形结构返回所有角色和对应的权限
export function getListAllWithRole(data) {
  return http({
    url: `/roleCategory/listAllWithRole`,
    method: "get",
    params: data,
  });
}

// 获取访客列表
export function fetchVisitors(data) {
  return http({
    url: `/user/getVisitorList/${data.limit}/${data.page}`,
    method: "post",
    data: data,
  });
}

// 获取paidui 列表
export function fetchQueue(data) {
  return http({
    url: `/sessin/queue/${data.page}/${data.limit}`,
    method: "get",
  });
}

// 获取客户信息
export function getCustomerInfo(data) {
  return http({
    url: `/user/UserInfo/${data.userid}`,
    method: "get",
  });
}

// 用户右侧的聊天提交资料
export function completeUserInfo(data) {
  return http({
    url: `/user/completeUserInfo`,
    method: "post",
    data,
  });
}

// 条件查询用户列表
export function getUserListByCondition(data) {
  return http({
    url: `/user/admin/getUserListByCondition/${data.limit}/${data.page}`,
    method: "post",
    data,
  });
}

// 新增用户
export function addUser(data) {
  return http({
    url: `/user/addUser`,
    method: "post",
    data,
  });
}

// 用户锁定/解锁
export function lockUser(data) {
  return http({
    url: `/user/lockUser`,
    method: "post",
    data,
  });
}

// 获取用户信息
export function getUserInfo(data) {
  return http({
    url: `/user/getUserInfo`,
    method: "get",
    params: data,
  });
}

// 新增用户分组
export function AddUserGroup(data) {
  return http({
    url: `/userGroup/AddUserGroup`,
    method: "post",
    data,
  });
}

// 获取分组列表
export function getUserGroup(data) {
  return http({
    url: `/userGroup/list`,
    method: "get",
  });
}

// 获取所有角色
export function getAllRole() {
  return http({
    url: `/roleCategory/list`,
    method: "get",
  });
}

// 新增角色
export function addRoleByName(data) {
  return http({
    url: `/roleCategory/create`,
    method: "post",
    data,
  });
}
// 新增角色
export function editeRole(data) {
  return http({
    url: `/roleCategory/update`,
    method: "post",
    data,
  });
}

// 根据ID删除角色分类

export function delteRole(data) {
  return http({
    url: `/roleCategory/delete/${data.id}`,
    method: "post",
    data,
  });
}

// 修改客服资料
export function updategroup(data) {
  return http({
    url: `/user/update`,
    method: "post",
    data,
  });
}
// 删除客服资料
export function deletegroup(data) {
  return http({
    url: `/user/delete/${data.userId}`,
    method: "post",
    data,
  });
}
// 获取地区树状列表

export function getAllAreaList(data) {
  return http({
    url: `/area/list`,
    method: "get",
    params: data,
  });
}

// 获取客服欢迎语

export function getKefuGreetingSetting(data) {
  return http({
    url: `/kefuInfo/GetKefuGreetingSetting`,
    method: "get",
    params: data,
  });
}
// 设置客服欢迎语

export function SetKefuGreeting(data) {
  return http({
    url: `/kefuInfo/SetKefuGreeting`,
    method: "post",
    data: data,
  });
}
// 获取客服信息

export function getKefuInfo(data) {
  return http({
    url: `/kefuInfo/GetKefuInfo`,
    method: "get",
    params: data,
  });
}
// 更新客服名片

export function setKefuInfo(data) {
  return http({
    url: `/kefuInfo/UpdateKefInfo`,
    method: "post",
    data: data,
  });
}

// 更新客服名片

export function UpdateUserGroup(data) {
  return http({
    url: `/userGroup/UpdateUserGroup`,
    method: "post",
    data: data,
  });
}
// 更新客服名片

export function DeleteUserGroup(data) {
  return http({
    url: `/userGroup/DeleteUserGroup/${data.id}`,
    method: "post",
    data: data,
  });
}
